module(...,package.seeall)

layout={
  TextView;
  layout_width="80dp";
  layout_height="40dp";
  padding="4dp";
  gravity="center";
  minHeight="40dp";
  minWidth="48dp";
  textColor=普通文字色
  --background=MD2ButtonBackground(nil,强调色,淡色强调波纹);
}
function __call(self,config)
  local buttonTable=table.clone(layout)
  buttonTable.background=MD2ButtonBackground()
  for index,content in pairs(config) do
    switch index do
     case "style" then
      for content in string.split(content,"|") do
        switch content do
         case "noFrame" then
          if buttonTable.textColor==强调色 then
            buttonTable.background=NoFrameButton(nil,淡色强调波纹)
           else
            buttonTable.background=NoFrameButton()
          end
         case "thin" then
          buttonTable.layout_width="48dp"
         case "accent" then
          buttonTable.background=MD2ButtonBackground(nil,强调色,淡色强调波纹)
          buttonTable.textColor=强调色
         case "default" then
          buttonTable.background=MD2ButtonBackground()
          buttonTable.textColor=普通文字色
        end
      end
     default
      buttonTable[index]=content
    end
  end
  return buttonTable
end